// components/add-task/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },
  data: {
    idx:0,
    colors:[
      "#000000",
      "#1296db",
      "#FF0000",
      "#FFFF00",
      "#00FF00",
      "#FF8000"
    ],
    showColors:false,
    value:""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    selectColor(e){
      this.setData({
        idx:e.currentTarget.dataset.idx,
        showColors:false
      })
    },
    showColors(){
      this.setData({
        showColors:true
      })
    },
    getInput(e){
      this.setData({
        value:e.detail.value
      })
    },
    sure(){
      let color = this.data.colors[this.data.idx];
      let value = this.data.value;
      this.triggerEvent("change",{
        color:color,
        value:value
      },{})
    }
  }
})
